Developer Documentation
PATH  Mac OS X Documentation > Cocoa > Application Design for Scripting, Documents, and Undo


Previous | Chapter contents | Next | Book PDF

Document Architecture

The new document architecture in the Application Kit is based on three classes: NSDocument, NSWindowController, and NSDocumentController. NSDocument is the principal class. It represents a single document in your application. Developers must subclass NSDocument to give it knowledge of the application's model layer and to implement persistence (loading and saving). NSWindowControllers own and control the application's user interface. An NSDocument has one or more NSWindowControllers. Developers often subclass NSWindowController to add specific knowledge of the view layer that the controller is responsible for managing. NSDocumentController is a singleton class. Each document-based application has a single instance of NSDocumentController to track and manage all open documents. Developers typically don't need to subclass NSDocumentController.

NSDocuments Are Model-Controllers

NSWindowControllers Are View-Controllers

Type Information and NSDocumentControllers

Typical Usage Patterns

Documents and Scripting


Application Design for Scripting, Documents, and Undo

Previous | Chapter contents | Next | Book PDF